<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>用户管理</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Bdrun/user')}">
         用户手机号：<input type="text" name="formget[mobile]" style="width: 100px;" value="{$formget.mobile}"> &nbsp;&nbsp;
        用户级别：
        <select class="select_2" name="formget[user_level_id]"  style="width: 110px;" >
            <option value="-1" {$formget[user_level_id]==-1?selected:''}>全部</option>
            <volist name="level_data" id="vo">
                <if condition="$formget.user_level_id == $vo[user_level_id]">
                    <option value="{$vo.user_level_id}" selected>{$vo.level_name}</option>
                    <else /><option value="{$vo.user_level_id}" >{$vo.level_name}</option>
                </if>

            </volist>
        </select> &nbsp;&nbsp;
        账号状态：
        <select class="select_2" name="formget[account_status]"  style="width: 80px;" >
            <if condition="$formget[account_status]==1">
                <option value='1' selected>正常</option>
                <option value='0' }>冻结</option>

            <else/>
                <option value='1'>正常</option>
                <option value='0' selected }>冻结</option>
            </if>

        </select> &nbsp;&nbsp;
        是否大客户：
        <select class="select_2" name="formget[is_shop]"  style="width: 110px;" >
            <option value="-1" {$formget[is_shop]==-1?selected:''}>全部</option>
            <option value="0" {$formget[is_shop]==0?selected:''}>否</option>
            <volist name="shop_data" id="vo">
                <if condition="$formget.is_shop == $vo[shop_id]">
                    <option value="{$vo.shop_id}" selected>{$vo.shop_name}</option>
                    <else /><option value="{$vo.shop_id}" >{$vo.shop_name}</option>
                </if>

            </volist>
        </select> &nbsp;&nbsp;
        <input type="submit" class="btn btn-primary" value="搜索" />
    </form>
    总数：{$total_count}人
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th align="center">序号</th>
                <th>{:L('MOBILE')}</th>
                <th>{:L('USER_LEVEL')}</th>
                <th>{:L('GROWTH_VALUE')}</th>
                <th>{:L('CITY')}</th>
                <th>好评率</th>
                <th>{:L('ACCOUNT_STATUS')}</th>
                <th>{:L('IS_SHOP')}</th>
                <th>{:L('REGIST_TIME')}</th>
                <th>{:L('COMP_ORDER_NUM')}</th>
                <th>账户余额</th>
                <th>积分</th>
                <th align="center">{:L('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="lists" item="vo" key="k">
                <php>$mobile_new = substr_replace($vo['mobile'], '****', 5, 4);
                    $user_name = $vo['user_name'];
                    if($vo['mobile']==$vo['user_name'])
                        $user_name = substr_replace($vo['mobile'], '****', 5, 4);
                </php>
                <tr>
                    <td align="center">{$k+1}</td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.user_level_id|getUserLevel}</td>
                    <td>{$vo.growth_value}</td>
                    <td>{$vo.city_id|getCompanyName}</td>
                    <td>{$vo.praise}%</td>
                    <td>{$vo['account_status']==1?启用:冻结}</td>
                    <td>{$vo['is_shop']|getShopName}</td>
                    <td>{$vo['regist_time']}</td>
                    <td>{$vo['user_id']|get_user_finish_order}</td>
                    <td>{$vo['purse_balance']}</td>
                    <td>{$vo['points_value']}</td>
                    <td align="center">
                        <if condition="$vo['account_status'] =='1'">
                        <a href="{:U('bdrun/freezee',array('user_id'=>empty($vo['user_id'])?'':$vo['user_id'],'formget'=>$formget))}" class="js-ajax-dialog-btn"  data-msg="{:L('FREEZE_USER_CONFIRM_MESSAGE')}">{:L('FREEZE_USER')} |</a>
                            <else />
                        <a href="{:U('bdrun/cancelfreezee',array('user_id'=>$vo['user_id'],'formget'=>$formget))}" class="js-ajax-dialog-btn" data-msg="{:L('ACTIVATE_USER_CONFIRM_MESSAGE')}">{:L('ACTIVATE_USER')} |</a>
                        </if>
                        <a href="{:U('bdrun/see',array('user_id'=>$vo['user_id'],'formget'=>$formget))}">查看 |</a>
                        <a href="{:U('Bdrun/user_shop',array('user_id'=>$vo['user_id'],'formget'=>$formget))}">挷客户</a>
                        <if condition="$vo['points_value'] gt 0 ">
                            <a href="{:U('Bdrun/used_points_value',array('user_id'=>$vo['user_id'],'formget'=>$formget))}">|积分使用</a>
                        </if>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <if condition="empty($lists)">
            <div style="padding: 30px;text-align: center;color: #999999">
                <i class="fa fa-database" style="font-size: 38px"></i><br />
                暂无数据
            </div>
        </if>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" >
    /**
     * 使用积分
     */
    function used_points_value(user_id,order_count) {
        if(order_count==null || order_count=="")
            order_count = 0;
        layer.prompt({title: '原积分【'+order_count+'】分，请输入积分使用量：', formType: 3}, function(counts, index){
//            layer.close(index);
            if( order_count < counts ){
                alert('使用的积分不能超过'+order_count+"分");
                return ;
            }

            $.ajax({
                type: "GET",
                async: true,
                url: "{:U('Bdrun/used_points_value')}",//接单跑客的位置
                data:"id="+user_id+"&counts="+counts,
                dataType: "json",
                success: function(data) {
//                    if(data == 1 )
//                        alert("设置成功");
                    window.location.reload();
//                    else
//                         alert("设置失败");
                }
            });
        });
    }

</script>
</body>
</html>